- /* slflfact.cpp by K.Tsuru */
- // function ID = 2001 DRADIX(reference)
- /****************************************************************************
- SLong class
- It provides the factrial n! using the SLong arithmetic. It is very slow in
- comparison with FactPF() in which the prime factorization is used.
- ****************************************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SLong LFact(ulong n){
- //the number of figure by Stirling's formula in the decimal system
- long sn = Stirling(n);
- long fig = sn/DFIGURES; //in the radix DRADIX
- if(sn % DFIGURES) fig++;
-
- SLong result(SNumber::DEC_INT, (uint)fig, 1.0); // result = 1
- ulong j;
-
- for(j = 2uL; j <= n; j++) result = LsMult(result, j);
-
- return result;
- }
slflfact.cpp : last modifiled at 2017/03/17 11:10:48(780 bytes)
created at 2017/10/07 10:26:49
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).